package com.sky.mapper;

import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {

    /**
     * 根据用户id和菜品id套餐id查询
     * @param shoppingCart 购物车实体类
     * @return
     */
    List<ShoppingCart> list(ShoppingCart shoppingCart);

    /**
     * 更新购物车
     * @param cart 购物车
     */
    @Update("update shopping_cart set number = #{number} where id = #{id}")
    void update(ShoppingCart shoppingCart);

    /**
     * 插入购物车
     * @param shoppingCart 购物车实体类
     */
    void Insert(ShoppingCart shoppingCart);

    /**
     * 删除购物车
     * @param shoppingCart
     */
    void deleteByUserId(ShoppingCart shoppingCart);

    /**
     * 批量插入购物车
     * @param shoppingCartList 购物车集合
     */
    void insertshoppingCars(List<ShoppingCart> shoppingCartList);
}
